#ifndef JZ_CO_MUTEX_H_
#define JZ_CO_MUTEX_H_

#include <QString>
#include <atomic>

//JZCoMutex
class JZCoMutex
{
public:
    JZCoMutex();
    ~JZCoMutex();

    bool tryLock();
    void lock();
    void unlock();

protected:
    Q_DISABLE_COPY(JZCoMutex);

    std::atomic<bool> m_locked;
};

//JZCoMutexLocker
class JZCoMutexLocker
{
public:
    JZCoMutexLocker(JZCoMutex *mutex);
    ~JZCoMutexLocker();

protected:
    JZCoMutex *m_mutex;
};









#endif